package shapewar.conf;

import shapewar.activities.FrameActivity;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.util.DisplayMetrics;

public class Conf {
	public static boolean robot = false;
	public static int FPS = 30;
	public static final int depth_map = 1;
	public static final int depth_visible_area = 50;
	public static final int depth_tank = 100;
	public static final int depth_wall = 120;
	public static final int depth_button = 125;
	public static final int depth_protector = 130;
	public static final int depth_pointView = 180;
	public static final int depth_bullet = 200;
	public static final int depth_textView = 300;
	public static final int depth_arrangeList = 500;
	
	public static final int tank_color = Color.RED;
	public static final int protector_color = Color.YELLOW;
	public static final int bullet_color = Color.rgb(127, 127, 127);
	
	public static final int flash_step = 20;
	public static int fire_cold_time = (int)(FPS * 0.3);
	public static int flash_cold_time = (int)(FPS * 2.0);
	
	public final static int super_time = FPS * 3;
	
	public static final float fire_angle = 45;
	public static final float protector_round_speed = 7;
	public static int protector_init_count = 2;
	
	
	public static float SIZE;
	public static float SPEED;
	
	public static float frame_width,frame_height;
	public static float map_width,map_height;
	
	public static float tank_speed;
	public static float bullet_speed;
	
	public static float toucher_view_radium;
	public static float point_view_radium;
	public static float visible_area_radium;
	public static float bullet_radium;
	
	public static float protector_radium;
	public static float protector_init_round_radium;
	
	public static float tank_size_factor;
	
	private static Context context = null;

	public final static int widget_fps = 24;
	public static void init() {
		context = FrameActivity.context;
		
		DisplayMetrics dm=new DisplayMetrics(); 
        ((Activity) FrameActivity.context).getWindowManager().getDefaultDisplay().getMetrics(dm); 
        frame_width = dm.widthPixels;
        frame_height = dm.heightPixels;
        
        SIZE = dip2px(10f)/10f;
        SPEED = dip2px(10f)/10f;
        
        map_width = SIZE * 2400f;
        map_height = SIZE * 2000f;
        
        
        toucher_view_radium = SIZE * 50f;
        point_view_radium = SIZE * 10f;
		bullet_radium = SIZE * 4.1f;
		protector_radium = SIZE * 4.3f;
		protector_init_round_radium = SIZE * 30f;
		visible_area_radium = SIZE * 335f;
		
		tank_size_factor = SIZE * 12f;
		bullet_speed = SPEED * 13.5f; //4 * bullet_radium
		tank_speed = SPEED * 7f;
	}
	
	public static float dip2px(float dipValue){
        final float scale = context.getResources().getDisplayMetrics().density;
        return (float)(dipValue * scale + 0.5f); 
	}
	public static float px2dip(float pxValue){ 
        final float scale = context.getResources().getDisplayMetrics().density; 
        return (float)(pxValue / scale + 0.5f); 
	}
	
}